package com.barry.pattern.singleton;

/**
 * @ClassName SingletonInnerClass
 * @Description TODO
 * @Author wangxuexing
 * @Date 2020/2/17 15:54
 * @Version 1.0
 */
public class SingletonInnerClass {
    private SingletonInnerClass(){}

    public static SingletonInnerClass getInstance(){
        return Singleton.singletonInnerClass;
    }

    private static class Singleton{
        private static SingletonInnerClass singletonInnerClass = new SingletonInnerClass();
    }

    public static void main(String[] args) {
        SingletonInnerClass a = SingletonInnerClass.getInstance();
        SingletonInnerClass b  = SingletonInnerClass.getInstance();
        System.out.println((a == b));
    }
}
